﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace WorkFlowCore.Framework.Utils
{
    public class MD5Helper
    {
        /// <summary>
        /// 32位MD5加密
        /// </summary>
        /// <param name="password"></param>
        /// <returns></returns>
        public static string MD5Encrypt32(string password)
        {
            using (MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider())
            {
                byte[] bytes = Encoding.UTF8.GetBytes(password);
                byte[] array = mD5CryptoServiceProvider.ComputeHash(bytes);
                StringBuilder sb = new StringBuilder();
                foreach (var a in array)
                {
                    sb.AppendFormat("{0:x2}", a);
                }
                return sb.ToString();
            }
        }
    }
}
